/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Presente;

import Enum.Usuarios;
import View.LoginView;
import View.MainGerenteView;
import View.MainVendedorView;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author Thalyta
 */
public class LoginPresente {
    
    
  LoginView vie = new LoginView();
  
    public LoginPresente() {
        
      carregacombox();  
      
      vie.getBtnentrar().addActionListener(new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
             entrar();
          }
      });
        vie.setLocation(500, 250);
      vie.setVisible(true);
    }
 
    public void carregacombox(){
      Usuarios[] ts = Usuarios.values();
      
      for(Usuarios tipos : ts){ 
         vie.getCbxusuario().addItem(tipos.toString());
      
      }
      
  }
    
public void entrar(){
 
    if (vie.getCbxusuario().getSelectedItem().toString().equals("Vendedor")){
            MainVendedorView main = new MainVendedorView();
            MainVendedorPresente contvendedor = new MainVendedorPresente(main);


    }
    
    if (vie.getCbxusuario().getSelectedItem().toString().equals("Gerente")){
        MainGerenteView maiin = new MainGerenteView();
        MainGerentePresente cont = new MainGerentePresente(maiin);
            }
  vie.setVisible(false);      

}
}
